<#include "../common/layout/__mainlayout.html">
    <#include "../common/__pagination.html">

        <!--设置面包屑-->
        <#assign pageBreadCrumbs>
            <li class="active"><a href="#">应用推荐</a></li>
            <li class="active">最美应用管理</li>
        </#assign>


        <#assign pageCss>
            <!-- page specific plugin styles -->
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/jquery-ui.custom.css"/>
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/chosen.css"/>
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/datepicker.css"/>
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/daterangepicker.css"/>

        </#assign>

        <#assign pageJavascript>
            <script type="text/javascript">
                $(document).ready(function () {
                    $('[data-rel=tooltip]').tooltip();

                    if (!ace.vars['touch']) {
                        $('.chosen-select').chosen({allow_single_deselect: true});
                    }

                    // 清除远程modal数据
                    $("#editModal").on("hidden.bs.modal", function () {
                        $(this).removeData("bs.modal");
                    });

                    // 删除按钮
                    $("a.delete").on(ace.click_event, function (e) {
                        submitClickListener(this, e, "删除");
                    });


                    // 显示按钮
                    $("a.showState").on(ace.click_event, function (e) {
                        submitClickListener(this, e, "展示");
                    });

                    // 隐藏按钮
                    $("a.hiddenState").on(ace.click_event, function (e) {
                        submitClickListener(this, e, "隐藏");
                    });


                    function submitClickListener(obj, e, title) {
                        var currentA = obj;
                        e.preventDefault();
                        bootbox.confirm({
                                    message: "确定" + title + "该最美最美应用?",
                                    buttons: {
                                        confirm: {
                                            label: "确定",
                                            className: "btn-primary btn-sm"
                                        },
                                        cancel: {
                                            label: "取消",
                                            className: "btn-sm"
                                        }
                                    },
                                    callback: function (result) {
                                        if (result) {
                                            url = $(currentA).attr("href");
                                            $.get(url, {}, function (data) {
                                                if (data) {
                                                    window.location="${ctx}/admin/soft/evaluating/listSoftEvaluating.html";
                                                }
                                            });
                                        }
                                    }
                                }
                        );
                    }
                });
            </script>
            <script>
                function page(pageNum) {
                    $("#pageNo").val(pageNum);
                    $("#searchForm").submit();
                }
            </script>
        </#assign>


        <@mainlayout pageBreadCrumbs=pageBreadCrumbs pageCss=pageCss pageJavascript=pageJavascript currentMenu="recommendFlag-SoftEvaluatingFlag">

        <form id="searchForm" class="form-search form-inline">
            <div class="row">
                <div class="widget-body">
                    <div class="widget-main">
                        <div class="form-group  col-xs-12" style="padding-top:10px">
                            <label class="col-xs-1 text-right">最美应用ID:</label>
                            <input type="number" id="id" name="id" class="input-sm col-xs-2"  max="99999999999" value="${query.id!}"/>
                            <label class="col-xs-1 text-right">标题:</label>
                            <input type="text" id="title" name="title" class="input-sm col-xs-2"  value="${query.title!}"/>
                            <div class="col-xs-6 ">
                                <input type="submit" id="searchButton" class="btn btn-sm btn-primary" value="查询"/>&nbsp;
                                <a href="${ctx}/admin/soft/evaluating/viewSoftEvaluating.do" class="btn btn-sm btn-warning"><i class="ace-icon fa fa-plus"></i>添加</a>
                                <a href="${ctx}/admin/soft/evaluating/viewSoftEvaluating.do?fromMark=zuimeia" class="btn btn-sm btn-warning"><i class="ace-icon fa fa-plus"></i>添加最美应用</a>
                                <a href="${ctx}/admin/soft/evaluating/viewSoftEvaluating.do?fromMark=zuimeig" class="btn btn-sm btn-warning"><i class="ace-icon fa fa-plus"></i>添加最美游戏</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
        <table id="softEvaluatingTable" class="table table-striped table-bordered table-hover">
            <thead>
            <tr>
                <th width="62" align="center">logo</th>
                <th width="40" align="center">ID</th>
                <th width="60" align="left">标题</th>
                <th width="60" align="left">分类名</th>
                <th width="40" align="left">状态</th>
                <th width="70" align="center">操作</th>
            </tr>
            </thead>
            <tbody>
            <#list softEvaluatings.listData as softEvaluating>
                <#if softEvaluating??>
                    <tr>
                        <td><img width="62" src="${staticHost}${softEvaluating.logo!}"  onerror="this.src='${ctx}/static/admin/assets/img/imgerror.png'" alt="未上传Logo图"/></td>
                        <td width="60" align="left">${softEvaluating.id!}</td>
                        <td width="40" align="left">${softEvaluating.title!}</td>
                        <td width="60" align="left">${softEvaluating.categoryName!}</td>
                        <td width="40" align="left">${softEvaluating.stateName!}</td>
                        <td>
                            <div class="hidden-sm hidden-xs action-buttons">
                                <a class="green tooltip-success edit"
                                   href="${ctx}/admin/soft/evaluating/viewSoftEvaluating.do?id=${softEvaluating.id!}"
                                   data-rel="tooltip" title="编辑"><span class="label label-success">编辑</span></a>
                                <a class="red tooltip-error delete"
                                   href="${ctx}/admin/soft/evaluating/delete.do?id=${softEvaluating.id!}"
                                   data-rel="tooltip" title="删除"> <span class="label label-danger">删除</span> </a>

                                <#if softEvaluating.state == 1>
                                    <a class="green tooltip-warning hiddenState"
                                       href="${ctx}/admin/soft/evaluating/hide.do?id=${softEvaluating.id!}"
                                       data-rel="tooltip" title="隐藏"> <span class="label label-info">隐藏</span></a>
                                    <#else>
                                        <a class="green tooltip-warning showState"
                                           href="${ctx}/admin/soft/evaluating/show.do?id=${softEvaluating.id!}"
                                           data-rel="tooltip" title="展示"> <span class="label label-info">展示</span></a>
                                </#if>
                            </div>
                        </td>

                    </tr>
                </#if>
            </#list>
            </tbody>
        </table>
        <@pagination softEvaluatings!/>
    </@mainlayout>